package com.czy.owner.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * Time:1/12/18 22:43
 * Created by Curtain.
 */

public class WheelAttrParentModel {

    private String name;
    private int id;
    private List<WheelAttrModel> attrModelList;

    public WheelAttrParentModel() {
    }

    public WheelAttrParentModel(int id, String name, List<WheelAttrModel> objects) {
        this.name = name;
        this.id = id;
        this.attrModelList = objects;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<WheelAttrModel> getAttrModelList() {
        return attrModelList;
    }

    public void setAttrModelList(List<WheelAttrModel> attrModelList) {
        this.attrModelList = attrModelList;
    }

    public static WheelAttrParentModel transfer(SpecialGoodsAttrModel.AttributesListBean attributesListBean){

        WheelAttrParentModel model = new WheelAttrParentModel();
        model.setId(attributesListBean.getGoodsAttributesId());
        model.setName(attributesListBean.getGoodsAttributesName());
        List<WheelAttrModel> attrModels = new ArrayList<>();
        for(int i = 0 ; i < attributesListBean.getValues().size();++i){
            attrModels.add(new WheelAttrModel(attributesListBean.getValues().get(i).getGoodsAttributesValueId(),
                    attributesListBean.getValues().get(i).getAttributesValue()));
        }
        model.setAttrModelList(attrModels);

        return model;

    }
}
